package com.byxm.wlgw.listener;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;



import com.byxm.wlgw.common.ComConst;
import com.byxm.wlgw.common.ComUtil;
import com.opensymphony.xwork2.ActionSupport;

/**
 * Application Lifecycle Listener implementation class InitListener
 *
 */
public class InitListener extends ActionSupport implements ServletContextListener {
	
	private static final long serialVersionUID = 1L;
	//读取资源配置文件类
	private static Properties p ;
	

    /** 
     * Default constructor. 
     */
    public InitListener() {
    	p = new Properties();
		try {
			p.load(new FileInputStream(((Object)(new ComUtil())).getClass().getResource("/").getPath()+"globalMessages_zh_CN.properties"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
    	
//		ComConst.G_UploadFilePath = p.getProperty("zwgk.upload");
//		ComConst.G_UploadImgPath = p.getProperty("admin.upload");
//		ComConst.G_SysWebName = p.getProperty("SysWebName");
//		ComConst.G_FckFileDir = p.getProperty("FckFileDir");		
//		ComConst.G_ProjectName = p.getProperty("projectName");		
//		ComConst.BeforeStatYears = p.getProperty("BeforeStatYears");		
//		ComConst.AfterStatYears = p.getProperty("AfterStatYears");
//		ComConst.WebServiceUrl = p.getProperty("webService.url");
//		ComConst.WebServiceMethod=p.getProperty("webService.method");
//		ComConst.G_FCKUploadPath=p.getProperty("admin.fckUpload");
//		ComConst.REQUESTADDR = p.getProperty("requestAddr");
		ComConst.JNDI_NAME = p.getProperty("jndiName");
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        // TODO Auto-generated method stub
    }
	
}
